﻿#include "hotelplatformclient.h"
#include "ui_hotelplatformclient.h"
#include <QStringBuilder>
#include <QMessageBox>

HotelPlatformClient::HotelPlatformClient(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::HotelPlatformClient)
{
    ui->setupUi(this);

    ui->mainToolBar->hide();
    ui->menuBar->hide();
    ui->statusBar->hide();
    this->setContextMenuPolicy(Qt::NoContextMenu);                                       //去掉工具栏的右键菜单
    this->setCentralWidget(ui->widget);

    this->setWindowFlags(windowFlags()&~Qt::WindowMaximizeButtonHint); // 禁止最大化按钮
    this->setFixedSize(this->width(),this->height());                                         // 禁止拖动窗口大小

    initWindows();
}

HotelPlatformClient::~HotelPlatformClient()
{
    delete ui;
}

void HotelPlatformClient::initWindows()
{
    m_oper = nullptr;
    m_msgSocket = new MsgSocket();
    m_loginForm = new LoginForm(ui->widget);

    m_userHomePage = nullptr;
    m_contactService = nullptr;
    m_searchHotel = nullptr;
    m_collectionList = nullptr;
    m_orderFormList = nullptr;
    m_hotelDetails = nullptr;

    m_hotelManage = nullptr;
    m_orderManage = nullptr;
    m_commentManage = nullptr;

    m_orderCenter = nullptr;
    m_certCenter = nullptr;

    connectSignalsAndSlots();
    m_msgSocket->start();

    m_isCloseSystem = true;
    m_isLogOut = false;
}
void HotelPlatformClient::initUserShow()
{
    ui->mainToolBar->clear();
    ui->mainToolBar->addAction(ui->actionMycenter);
    ui->mainToolBar->addAction(ui->actionfindHotel);
    ui->mainToolBar->addAction(ui->actionorderForm);
    ui->mainToolBar->addAction(ui->actionsaveCenter);
    ui->mainToolBar->addAction(ui->actioncustomer);
    ui->mainToolBar->addAction(ui->actionSetting);
    ui->mainToolBar->addAction(ui->actionlogout);
    ui->actionMycenter->setEnabled(false);

    if (m_searchHotel != nullptr)
    {
        delete m_searchHotel;
    }
    if (m_collectionList != nullptr)
    {
        delete m_collectionList;
    }
    if (m_orderFormList != nullptr)
    {
        delete m_orderFormList;
    }
    if (m_hotelDetails != nullptr)
    {
        delete m_hotelDetails;
    }
    m_searchHotel = new SearchHotel(ui->widget);
    m_collectionList = new CollectionList(ui->widget);
    m_orderFormList = new OrderFormList(ui->widget);
    m_hotelDetails = new HotelDetails(ui->widget);

    connectSignalsSlotsForUser();
    m_searchHotel->close();
    m_collectionList->close();
    m_orderFormList->close();
    m_hotelDetails->close();
}
void HotelPlatformClient::initBusinessManShow()
{
    ui->mainToolBar->clear();
    ui->mainToolBar->addAction(ui->actionMycenter);
    ui->mainToolBar->addAction(ui->actionhotelManage);
    ui->mainToolBar->addAction(ui->actioncommentManage);
    ui->mainToolBar->addAction(ui->actionorderFormList);
    ui->mainToolBar->addAction(ui->actionbusinessManage);
    ui->mainToolBar->addAction(ui->actionreportQuery);
    ui->mainToolBar->addAction(ui->actioncustomer);
    ui->mainToolBar->addAction(ui->actionSetting);
    ui->mainToolBar->addAction(ui->actionlogout);
    ui->actionMycenter->setEnabled(false);

    if (m_hotelManage != nullptr)
    {
        delete m_hotelManage;
    }
    if (m_orderManage != nullptr)
    {
        delete m_orderManage;
    }
    if (m_commentManage != nullptr)
    {
        delete m_commentManage;
    }
    m_hotelManage = new HotelManage(ui->widget);
    m_orderManage = new OrderManageBus(ui->widget);
    m_commentManage = new CommentManage(ui->widget);
    connectSignalsSlotsForBusiness();

    m_hotelManage->close();
    m_orderManage->close();
    m_commentManage->close();
}
void HotelPlatformClient::initWorkerShow()
{
    ui->mainToolBar->clear();
    ui->mainToolBar->addAction(ui->actionMycenter);
    ui->mainToolBar->addAction(ui->actioncertCenter);
    ui->mainToolBar->addAction(ui->actionorderCenter);
    ui->mainToolBar->addAction(ui->actioncustomer);
    ui->mainToolBar->addAction(ui->actionSetting);
    ui->mainToolBar->addAction(ui->actionlogout);
    ui->actionMycenter->setEnabled(false);

    if (m_orderCenter != nullptr)
    {
        delete m_orderCenter;
    }
    if (m_certCenter != nullptr)
    {
        delete m_certCenter;
    }
    m_orderCenter = new OrderCenter(ui->widget);
    m_certCenter = new CertificateCenter(ui->widget);
    connectSignalsSlotsForWorker();
    m_orderCenter->close();
    m_certCenter->close();
}

void HotelPlatformClient::connectSignalsAndSlots()
{
    connect(m_msgSocket, SIGNAL(signalErrorInterNet()),
            this, SLOT(slotErrorInterNet()));
    connect(m_msgSocket, SIGNAL(signalUserLogoutResult(bool)),
            this, SLOT(slotUserLogoutResult(bool)));

    connect(m_loginForm,SIGNAL(signalUserRegisterLogin(QStringList)),
            this,SLOT(slotUserRegisterLogin(QStringList)));
    connect(m_loginForm,SIGNAL(signalUserLogin(QStringList)),
            this,SLOT(slotUserLogin(QStringList)));

    connect(m_msgSocket,SIGNAL(signalUserLoginResult(bool,const QString&)),
            this,SLOT(slotUserLoginResult(bool,QString)));
    connect(m_msgSocket,SIGNAL(signalUserRegisterResult(bool,const QString&)),
            this,SLOT(slotUserRegisterResult(bool,QString)));
    connect(m_msgSocket,SIGNAL(signalGainUserInfoResult(bool,const QString&)),
            this,SLOT(slotGainUserInfoResult(bool,QString)));
    connect(m_msgSocket,SIGNAL(signalUserImageResult(bool,const QImage&)),
            this,SLOT(slotUserImageResult(bool,const QImage&)));///download image
    connect(m_msgSocket,SIGNAL(signalModifyPasswordResult(bool,QString)),
            this,SLOT(slotModifyPasswordResult(bool,QString)));

    connect(m_msgSocket,SIGNAL(signalUploadCertImageSchedule()),
            this,SLOT(slotUploadCertImageSchedule()));///完善个人信息
    connect(m_msgSocket,SIGNAL(signalModifyUserInfosResult(bool,QString)),
            this,SLOT(slotModifyUserInfosResult(bool,QString)));///完善个人信息
    connect(m_msgSocket,SIGNAL(signalUploadCertificateResult(bool,QString)),
            this,SLOT(slotUploadCertificateResult(bool,QString)));


    connect(m_msgSocket,SIGNAL(signalSetHotelDetails(bool,const QString&)),
            this,SLOT(slotSetHotelDetails(bool,const QString&)));
}

void HotelPlatformClient::connectComSignalsAndSlots()
{
    connect(m_userHomePage,SIGNAL(signalModifyPassword(QString,QString)),
            this,SLOT(slotModifyPassword(QString,QString)));
    connect(m_userHomePage,SIGNAL(signalModifyHeadPic(const QString &)),
            this,SLOT(slotModifyHeadPic(const QString &)));
    connect(m_userHomePage,SIGNAL(signalUpdateUserInfos(const QStringList &)),
            this,SLOT(slotUpdateUserInfos(const QStringList &)));
    connect(m_userHomePage,SIGNAL(signalBusinessManCertificate(const QString& ,const QStringList &)),
            this,SLOT(slotBusinessManCertificate(const QString& ,const QStringList &)));
}

void HotelPlatformClient::connectSignalsSlotsForUser()
{
    connect(m_msgSocket,SIGNAL(signalSetHotelInfoList(bool,QString)),
            m_searchHotel,SLOT(slotSetHotelInfoList(bool,QString)));
    connect(m_msgSocket,SIGNAL(signalHotelSearchImage(const QString&, const QImage&)),          /// 酒店搜索 设置图片
            m_searchHotel,SLOT(slotHotelSearchImage(const QString&, const QImage&)));
    connect(m_msgSocket,SIGNAL(signalHotelDetailsImage()),          /// 酒店详情 设置图片
            m_hotelDetails,SLOT(slotHotelDetailsImage()));

    connect(m_msgSocket,SIGNAL(signalSetHouseList(bool,QString)),
            m_hotelDetails,SLOT(slotSetHouseList(bool,QString)));

    connect(m_msgSocket,SIGNAL(signalSetReserveList(bool,const QString&,const QString&)),
            m_orderFormList,SLOT(slotSetReserveList(bool,const QString&,const QString&)));

//////////////////////////////////////// comment /////////////////////////////////////
    connect(m_orderFormList,SIGNAL(signalGainReserveList()),
            m_msgSocket,SLOT(slotGainOrederFormList()));
    connect(m_msgSocket,SIGNAL(signalSubmitCommentResult(bool,QString)),
            m_orderFormList,SLOT(slotSubmitCommentResult(bool,QString)));
    connect(m_msgSocket,SIGNAL(signalSetCommentList(bool,const QString&)),
            m_hotelDetails,SLOT(slotSetCommentList(bool,const QString&)));
    connect(m_msgSocket,SIGNAL(signalSetCommentImage(bool,const QString&,const QImage&)),
            m_hotelDetails,SLOT(slotSetCommentImage(bool,const QString&,const QImage&)));


    connect(m_msgSocket,SIGNAL(signalSetSaveList(bool,QString)),
            m_collectionList,SLOT(slotSetSaveList(bool,const QString&)));

    connect(m_searchHotel,SIGNAL(signalGainHotelInfoListSocket(QString)),
            this,SLOT(slotGainHotelInfoListSocket(QString)));
    connect(m_searchHotel,SIGNAL(signalWatchCommentSearch()),
            m_hotelDetails,SLOT(slotJumpToComment()));

    connect(m_hotelDetails,SIGNAL(signalSubmitReserveHotel()),
            this,SLOT(slotSubmitReserve()));

    connect(m_orderFormList,SIGNAL(signalReserveCommentSubmit()),
            this,SLOT(slotCommentSubmit()));
    connect(m_orderFormList,SIGNAL(signalSubmitCommentImage(const QStringList&)),
            this,SLOT(slotSubmitCommentImage(const QStringList&)));



    connect(m_collectionList,SIGNAL(signalDeleteSaveHotelCollection(const QString&)),
            this,SLOT(slotDeleteSaveHotel(const QString&)));

    connect(m_collectionList,SIGNAL(signalGainHotelDetailsCollection(const QString&)),
            this,SLOT(slotGainHotelDetails(const QString&)));

    connect(m_searchHotel,SIGNAL(signalGainHotelDetailsSearch(const QString&)),
            this,SLOT(slotGainHotelDetails(const QString&)));

    //////////////////////////////// save ///////////////////////////////////
    connect(m_msgSocket,SIGNAL(signalSetSaveHotelImage(bool,const QString&,const QImage&)),
            m_collectionList,SLOT(slotSetSaveHotelImage(bool,const QString&,const QImage&)));
    connect(m_msgSocket,SIGNAL(signalSubmitSaveResult(bool,const QString&)),
            m_hotelDetails,SLOT(slotSubmitSaveResult(bool,const QString&)));

    //////////////////////////////// reserve ///////////////////////////////////
    connect(m_orderFormList,SIGNAL(signalGainReserveDetails(const QString&)),
            this,SLOT(slotGainReserveDetails(const QString&)));
    connect(m_msgSocket,SIGNAL(signalSetReserveDetails(bool,const QString&)),
            m_orderFormList,SLOT(slotSetReserveDetails(bool,const QString&)));
    connect(m_msgSocket,SIGNAL(signalSetReserveHotelImage(bool,const QString&,const QImage&)),
            m_orderFormList,SLOT(slotSetReserveHotelImage(bool,const QString&,const QImage&)));

    connect(m_orderFormList,SIGNAL(signalDeleteReserve(const QString&)),
            this,SLOT(slotDeleteReserve(const QString&)));
    connect(m_orderFormList,SIGNAL(signalGainHotelDetails(const QString&)),
            this,SLOT(slotGainHotelDetails(const QString&)));
    connect(m_msgSocket,SIGNAL(signalReserveDeleteResult(bool, const QString&)),
            m_orderFormList,SLOT(slotReserveDeleteResult(bool, const QString&)));

    /////////////////////////////////////house////////////////////////////////////////
    connect(m_msgSocket,SIGNAL(signalHouseImageResult(const QString&,const QImage&)),
            m_hotelDetails,SLOT(slotSaveHouseImage(const QString&,const QImage&)));
    connect(m_msgSocket,SIGNAL(signalSetHouseImage()),
            m_hotelDetails,SLOT(slotSetHouseImage()));

    connect(m_hotelDetails,SIGNAL(signalSubmitSaveHotel(bool)),
            this,SLOT(slotSubmitSaveHotel(bool)));

    connect(m_msgSocket,SIGNAL(signalSubmitReserveResult(bool, const QString&)),
            m_hotelDetails,SLOT(slotSubmitReserveResult(bool, const QString&)));
}

void HotelPlatformClient::on_actionMycenter_triggered()
{
    if (GlobalVars::g_localUser.getRole() == QString::number(USER_User))
    {
        ui->actionsaveCenter->setEnabled(true);
        ui->actionMycenter->setEnabled(false);
        ui->actionfindHotel->setEnabled(true);
        ui->actionorderForm->setEnabled(true);
        ui->actioncustomer->setEnabled(true);
        m_userHomePage->show();
        m_searchHotel->close();
        m_collectionList->close();
        m_orderFormList->close();
        m_contactService->close();

        m_hotelDetails->cleanHotelDetails();
        m_hotelDetails->close();
    }
    else  if (GlobalVars::g_localUser.getRole() == QString::number(USER_Business))
    {
        ui->actionMycenter->setEnabled(false);
        ui->actionhotelManage->setEnabled(true);
        ui->actioncustomer->setEnabled(true);
        ui->actionorderFormList->setEnabled(true);
        ui->actioncommentManage->setEnabled(true);

        m_userHomePage->show();
        m_hotelManage->close();
        m_orderManage->close();
        m_commentManage->close();
        m_contactService->close();
    }
    else
    {
        ui->actionMycenter->setEnabled(false);
        ui->actioncertCenter->setEnabled(true);
        ui->actionorderCenter->setEnabled(true);
        ui->actioncustomer->setEnabled(true);

        m_userHomePage->show();
        m_certCenter->close();
        m_orderCenter->close();
        m_contactService->close();
    }
}
void HotelPlatformClient::on_actioncustomer_triggered()
{
    if (GlobalVars::g_localUser.getRole() == QString::number(USER_User))
    {
        ui->actionsaveCenter->setEnabled(true);
        ui->actionMycenter->setEnabled(true);
        ui->actionfindHotel->setEnabled(true);
        ui->actionorderForm->setEnabled(true);
        ui->actioncustomer->setEnabled(false);

        m_contactService->show();
        m_loginForm->close();
        m_collectionList->close();
        m_orderFormList->close();
        m_userHomePage->close();
        m_searchHotel->close();
        m_hotelDetails->cleanHotelDetails();
        m_hotelDetails->close();
    }
    else  if (GlobalVars::g_localUser.getRole() == QString::number(USER_Business))
    {
        ui->actioncustomer->setEnabled(false);
        ui->actionMycenter->setEnabled(true);
        ui->actionhotelManage->setEnabled(true);
        ui->actionorderFormList->setEnabled(true);
        ui->actioncommentManage->setEnabled(true);

        m_contactService->show();
        m_userHomePage->close();
        m_hotelManage->close();
        m_orderManage->close();
        m_commentManage->close();
    }
    else
    {
        ui->actioncustomer->setEnabled(false);
        ui->actionMycenter->setEnabled(true);
        ui->actioncertCenter->setEnabled(true);
        ui->actionorderCenter->setEnabled(true);

        m_contactService->show();
        m_userHomePage->close();
        m_certCenter->close();
        m_orderCenter->close();
    }
}
void HotelPlatformClient::on_actionlogout_triggered()
{
    QMessageBox::StandardButton result = QMessageBox::warning(this,
                                 "警告",
                                 "确定要注销吗？",
                                 QMessageBox::Yes | QMessageBox::Cancel,
                                 QMessageBox::Yes);

    if (result == QMessageBox::Yes)
    {
        ui->mainToolBar->hide();

        m_loginForm->show();
        m_userHomePage->close();
        m_contactService->close();
        if (GlobalVars::g_localUser.getRole().toInt() == USER_User)
        {
            ui->actionsaveCenter->setEnabled(true);
            ui->actionMycenter->setEnabled(true);
            ui->actionfindHotel->setEnabled(true);
            ui->actionorderForm->setEnabled(true);

            m_collectionList->close();
            m_collectionList->slotSaveListClean();
            m_orderFormList->close();
            m_searchHotel->close();
            m_hotelDetails->cleanHotelDetails();
            m_hotelDetails->close();
        }
        else if (GlobalVars::g_localUser.getRole().toInt() == USER_Business)
        {
            ui->actionorderFormList->setEnabled(true);
            ui->actioncommentManage->setEnabled(true);
            ui->actionhotelManage->setEnabled(true);

            m_hotelManage->close();
            m_orderManage->close();
            m_commentManage->close();
        }
        else
        {
            ui->actioncertCenter->setEnabled(true);
            ui->actionorderCenter->setEnabled(true);

            m_orderCenter->close();
            m_certCenter->close();
        }

        m_isLogOut = true;
        slotUserLogout(LogOut_Offline);
    }
}
void HotelPlatformClient::on_actionSetting_triggered()
{
    if (m_oper != nullptr)
    {
        delete m_oper;
    }
    m_oper = new SettingOperate();
    m_oper->setWindowTitle("配置信息");
    m_oper->setWindowModality(Qt::ApplicationModal);
    m_oper->setWindowFlags(windowFlags()&~Qt::WindowMaximizeButtonHint); // 禁止最大化按钮
    m_oper->setFixedSize(m_oper->width(),m_oper->height());               // 禁止拖动窗口大小
    m_oper->show();
}

void HotelPlatformClient::on_actionfindHotel_triggered()
{
    ui->actionsaveCenter->setEnabled(true);
    ui->actionMycenter->setEnabled(true);
    ui->actionfindHotel->setEnabled(false);
    ui->actionorderForm->setEnabled(true);
    ui->actioncustomer->setEnabled(true);
    m_searchHotel->show();
    m_userHomePage->close();
    m_collectionList->close();
    m_orderFormList->close();
    m_contactService->close();

    m_hotelDetails->cleanHotelDetails();
    m_hotelDetails->close();

}
void HotelPlatformClient::on_actionorderForm_triggered()
{
    ui->actionsaveCenter->setEnabled(true);
    ui->actionMycenter->setEnabled(true);
    ui->actionfindHotel->setEnabled(true);
    ui->actionorderForm->setEnabled(false);
    ui->actioncustomer->setEnabled(true);
    m_orderFormList->show();
    m_userHomePage->close();
    m_searchHotel->close();
    m_collectionList->close();
    m_contactService->close();

    m_hotelDetails->cleanHotelDetails();
    m_hotelDetails->close();

    GainOrederFormList();
}
void HotelPlatformClient::on_actionsaveCenter_triggered()
{
    ui->actionsaveCenter->setEnabled(false);
    ui->actionMycenter->setEnabled(true);
    ui->actionfindHotel->setEnabled(true);
    ui->actionorderForm->setEnabled(true);
    ui->actioncustomer->setEnabled(true);
    m_collectionList->show();
    m_orderFormList->close();
    m_userHomePage->close();
    m_searchHotel->close();
    m_contactService->close();

    m_hotelDetails->cleanHotelDetails();
    m_hotelDetails->close();

    GainSaveList();
}

void HotelPlatformClient::on_actionhotelManage_triggered()
{
    ui->actionhotelManage->setEnabled(false);
    ui->actionMycenter->setEnabled(true);
    ui->actioncustomer->setEnabled(true);
    ui->actionorderFormList->setEnabled(true);
    ui->actioncommentManage->setEnabled(true);

    m_hotelManage->show();
    m_contactService->close();
    m_userHomePage->close();
    m_orderManage->close();
    m_commentManage->close();

    slotGainHotelManageList();
}
void HotelPlatformClient::on_actionorderFormList_triggered()
{
    ui->actionorderFormList->setEnabled(false);
    ui->actionhotelManage->setEnabled(true);
    ui->actionMycenter->setEnabled(true);
    ui->actioncustomer->setEnabled(true);
    ui->actioncommentManage->setEnabled(true);

    m_orderManage->show();
    m_hotelManage->close();
    m_commentManage->close();
    m_contactService->close();
    m_userHomePage->close();

    m_orderManage->setOptionalHotel();
//    slotGainOrderManageList(m_orderManage->getCurrentSelectedHotelID());
}
void HotelPlatformClient::on_actioncommentManage_triggered()
{
    ui->actioncommentManage->setEnabled(false);
    ui->actionorderFormList->setEnabled(true);
    ui->actionhotelManage->setEnabled(true);
    ui->actionMycenter->setEnabled(true);
    ui->actioncustomer->setEnabled(true);

    m_commentManage->show();
    m_orderManage->close();
    m_hotelManage->close();
    m_contactService->close();
    m_userHomePage->close();

    m_commentManage->setOptionalHotel();
//    slotGainHotelCommentList("0", m_commentManage->getCurrentSelectedHotelID());
}

void HotelPlatformClient::on_actioncertCenter_triggered()
{
    ui->actioncertCenter->setEnabled(false);
    ui->actionorderCenter->setEnabled(true);
    ui->actioncustomer->setEnabled(true);
    ui->actionMycenter->setEnabled(true);

    m_certCenter->show();
    m_orderCenter->close();
    m_userHomePage->close();
    m_contactService->close();

    m_certCenter->setCurentIndex(0);
    slotGainCertAllList(m_certCenter->getCurrentIndex());
}
void HotelPlatformClient::on_actionorderCenter_triggered()
{
    ui->actionorderCenter->setEnabled(false);
    ui->actioncertCenter->setEnabled(true);
    ui->actioncustomer->setEnabled(true);
    ui->actionMycenter->setEnabled(true);

    m_orderCenter->show();
    m_certCenter->close();
    m_userHomePage->close();
    m_contactService->close();

    slotGainOrderAllList();
}

void HotelPlatformClient::slotErrorInterNet()
{
    QMessageBox::warning(this, "错误", "网络连接异常", QMessageBox::Yes, QMessageBox::Yes);
    m_isCloseSystem = true;
}

void HotelPlatformClient::slotUserLogin(QStringList parameters)
{
    /// 用户登录请求
    QString msg = QString(CMD_UserLogin_L)
            % QString("#") % parameters.at(0)///id
            % QString("|") % parameters.at(1);///psd
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotUserLoginResult(bool result,QString msg)
{
    if (result)
    {
        m_isCloseSystem = false;

        m_loginForm->close();
        ui->mainToolBar->show();
        if (m_contactService != nullptr)
        {
            delete m_contactService;
        }
        m_contactService = new ContactCustomerService(ui->widget);
        m_contactService->close();

        if (m_userHomePage != nullptr)
        {
            delete m_userHomePage;
        }
        m_userHomePage = new UserHomePage(ui->widget);
        connectComSignalsAndSlots();
        m_userHomePage->show();

        ///个人信息请求
        QString msg = QString(CMD_UserInfo_I)
            % QString("#") % GlobalVars::g_localUser.getNumber()
            % QString("|") % GlobalVars::g_localUser.getRole();
        m_msgSocket->slotSendMsg(msg);

        if (GlobalVars::g_localUser.getRole().toInt() == USER_User)
        {
            GlobalVars::setHotelServerStyleSheetMap();
            this->setWindowTitle("客户端[用户端]");
            initUserShow();
        }
        else if (GlobalVars::g_localUser.getRole().toInt() == USER_Business)
        {
            this->setWindowTitle("客户端[商家端]");
            initBusinessManShow();
        }
        else
        {
             this->setWindowTitle("客户端[工作人员]");
            initWorkerShow();
        }
    }
    else
    {
        m_loginForm->FailUserLogin(msg);
    }
}
void HotelPlatformClient::slotUserRegisterLogin(QStringList parameters)
{
    /// 用户注册请求
    QString msg = QString(CMD_UserRegister_R)
            % QString("#") % parameters.at(0)///id
            % QString("|") % parameters.at(1)///psd
            % QString("|") % parameters.at(2)///role
            % QString("|") % parameters.at(3)///sex
            % QString("|") % parameters.at(4)///name
            % QString("|") % parameters.at(5)///phone
            % QString("|") % parameters.at(6);///birth
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotUserRegisterResult(bool result,QString msg)
{
    if (result)
    {
        m_loginForm->SuccessUserRegister(msg);
    }
    else
    {
        m_loginForm->FailUserLogin(msg);
    }
}
void HotelPlatformClient::slotUserLogout(int type)
{
    ///用户退出请求
    QString msg = QString(CMD_UserExit_X)
            % QString("#|") % GlobalVars::g_localUser.getNumber()
            % "|" % QString::number(type);
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotUserLogoutResult(bool result)
{
    m_isCloseSystem = result;
    if (!m_isLogOut)        /// 在注销时不关闭
    {
        this->close();
    }
    m_isLogOut = false;
}

void HotelPlatformClient::closeEvent(QCloseEvent *ev)
{
    if(m_isCloseSystem)                /// 初始化为true, 在未登录时直接退出, 在登录后变为false
    {
        ev->accept();
    }else
    {
        slotUserLogout(LogOut_Exit);
        ev->ignore();
    }
}
void HotelPlatformClient::slotModifyPasswordResult(bool result,QString msg)
{
    if (result)
    {
        m_userHomePage->FailGainInfos("成功",msg);
        m_userHomePage->close();
        m_loginForm->show();
    }
    else
    {
        m_userHomePage->FailGainInfos("错误",msg);
    }
}

void HotelPlatformClient::slotGainUserInfoResult(bool result,QString msg)
{
    if (result)
    {
        m_userHomePage->initUserInfos();

        ///获取头像请求
        QString msg = QString(CMD_HeadPic_i)
            % QString("#") % GlobalVars::g_localUser.getNumber();
        m_msgSocket->slotSendMsg(msg);
    }
    else
    {
        m_userHomePage->FailGainInfos("错误", msg);
    }
}

void HotelPlatformClient::slotUploadCertImageSchedule()
{
    m_userHomePage->businessManCertificateResult();
}

void HotelPlatformClient::slotModifyUserInfosResult(bool result,QString msg)
{
    if (result)
    {
        m_userHomePage->initUserInfos();
    }
    else
    {
        m_userHomePage->FailGainInfos("错误", msg);
    }
}

void HotelPlatformClient::slotUploadCertificateResult(bool result,QString msg)
{
    if (result)
    {
        ///个人信息请求
        QString msg = QString(CMD_UserInfo_I)
            % QString("#") % GlobalVars::g_localUser.getNumber()
            % QString("|") % GlobalVars::g_localUser.getRole();
        m_msgSocket->slotSendMsg(msg);
    }
    else
    {
        m_userHomePage->FailGainInfos("错误", msg);
    }
}

void HotelPlatformClient::slotUserImageResult(bool result,const QImage&image)
{
    if (result)
    {
        m_userHomePage->setHeadPic(image);
        if (GlobalVars::g_hotelManageMap.isEmpty())
        {
            if (GlobalVars::g_localUser.getRole().toInt() == USER_Business)
            {
                gainHotelManageIdAndName();
            }
        }
    }
    else
    {
        qDebug() << "头像error";
    }
}

void HotelPlatformClient::slotModifyPassword(QString oldPwd, QString newPwd)
{
    ///获取头像请求
    QString msg = QString(CMD_ModifyPswd_P)
        % QString("#") % GlobalVars::g_localUser.getNumber()
        % "|" % oldPwd % "|" % newPwd;
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotModifyHeadPic(const QString& path)
{
    ///获取头像请求
    QString msg = QString(CMD_UploadHeadPic_j)
        % QString("#") % GlobalVars::g_localUser.getNumber();

    m_msgSocket->slotSendImage(msg, path);
}
void HotelPlatformClient::slotUpdateUserInfos(const QStringList& msgList)
{
    ///更新用户信息
    QString msg = QString(CMD_UpdateUserInfo_U)
        % QString("#") % GlobalVars::g_localUser.getNumber()
        % "|" % msgList.at(0) % "|" % msgList.at(1)
            % "|" % msgList.at(2) % "|" % msgList.at(3)
            % "|" % msgList.at(4);
    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::slotBusinessManCertificate(const QString& realName,const QStringList& imageList)
{
    ///更新用户信息
    QString msg = QString(CMD_BusinessCertificate_C)
        % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % realName;

    m_msgSocket->slotSendImage(msg,imageList);
}

void HotelPlatformClient::slotGainHotelInfoListSocket(QString msg)
{
    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::slotSubmitReserve()
{
    ///提交订单
    /// cmd#userID|reserveID|hotelID|hotelName|hotelLocation|hotelPhone
    /// |state|houseType|reserveTime|checkInTime|checkOutTime
    /// |payment|checkInName|checkInTel|arrivalTime|houseCount
    QString msg = QString(CMD_SubmitReserve_D)
            % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % GlobalVars::g_localReserve.getReserve()
            % "|" % GlobalVars::g_localReserve.getHotel()
            % "|" % GlobalVars::g_localReserve.getHotelName()
            % "|" % GlobalVars::g_localReserve.getHotelLocation()
            % "|" % GlobalVars::g_localReserve.getHotelPhone()
            % "|" % GlobalVars::g_localReserve.getState()
            % "|" % GlobalVars::g_localReserve.getHouseType()
            % "|" % GlobalVars::g_localReserve.getReserveTime()
            % "|" % GlobalVars::g_localReserve.getCheckInTime() ///入住时间
            % "|" % GlobalVars::g_localReserve.getCheckOutTime() ///离店时间
            % "|" % QString::number(GlobalVars::g_localReserve.getPayment())
            % "|" % GlobalVars::g_localReserve.getCheckInName()
            % "|" % GlobalVars::g_localReserve.getCheckInTel()
            % "|" % GlobalVars::g_localReserve.getArrivalTime()
            % "|" % QString::number(GlobalVars::g_localReserve.getHouseCount());
    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::GainOrederFormList()
{
    ///清空订单列表
    m_orderFormList->reserveListClean();
    m_msgSocket->slotGainOrederFormList();
}

void HotelPlatformClient::GainSaveList()
{
    ///清空收藏列表
    m_collectionList->slotSaveListClean();

    ///获取收藏列表
    QString msg = QString(CMD_SaveList_s)
        % QString("#") % GlobalVars::g_localUser.getNumber() % "|0";
    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::slotCommentSubmit()
{
    ///提交评论
    /// cmd#user|comment|star|hotel|hotelName|houseType|checkInTime|commentTime|userComment|reserveID
    QString msg = QString(CMD_SubmitComment_p)
            % QString("#") % GlobalVars::g_localComment.getUser()
            % "|" % GlobalVars::g_localComment.getComment()
            % "|" % GlobalVars::g_localComment.getStar()
            % "|" % GlobalVars::g_localComment.getHotel()
            % "|" % GlobalVars::g_localComment.getHotelName()
            % "|" % GlobalVars::g_localComment.getHouseType()
            % "|" % GlobalVars::g_localComment.getCheckInTime()
            % "|" % GlobalVars::g_localComment.getCommentTime()
            % "|" % GlobalVars::g_localComment.getUserComment()
            % "|" % GlobalVars::g_localComment.getReserveID();


    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::slotSubmitCommentImage(const QStringList& pathList)
{
    QStringList imageList = pathList;

    m_msgSocket->slotSendImage(QString(CMD_SubmitCommentImage_m),imageList);
    ////  缺少接收到的反馈
}

void HotelPlatformClient::slotGainHotelDetails(const QString& hotelID)
{
    if (GlobalVars::g_localUser.getRole().toInt() == USER_User)
    {
        m_orderFormList->close();
        m_userHomePage->close();
        m_searchHotel->close();
        m_collectionList->close();
    }

    /// cmd#user|hotelID
    QString msg = QString(CMD_HotelDetailsByID_B)
            % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % hotelID;

    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::slotSetHotelDetails(bool result,const QString& msg)
{
    if (result)
    {
        if (GlobalVars::g_localUser.getRole().toInt() == USER_User)
        {
            m_hotelDetails->initWindowsUnits(GlobalVars::g_localHotel);
            m_hotelDetails->show();
        }
        else if (GlobalVars::g_localUser.getRole().toInt() == USER_Business)
        {
            m_hotelManage->slotSetHotelDetails();
        }
        else
        {
            m_certCenter->setHotelDetails();
        }
    }
}

void HotelPlatformClient::slotDeleteSaveHotel(const QString& saveID)
{
    /// cmd#user|saveID
    QString msg = QString(CMD_DeleteSave_B)
            % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % saveID;

    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::slotSubmitSaveHotel(bool isSave)
{
    /// cmd#user|hotelID|isSave
    QString save = "0";
    if (isSave)
    {
        save = "1";
    }

    QString msg = QString(CMD_SubmitSave_c)
            % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % GlobalVars::g_localHotel.getHotel()
            % "|" % save;

    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotGainReserveDetails(const QString& reserveID)
{
    /// cmd#user|reserveID
    QString msg = QString(CMD_ReserveDetails_a)
            % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % reserveID;

    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotDeleteReserve(const QString& reserveID)
{
    /// cmd#user|reserveID
    QString msg = QString(CMD_ReserveDelete_l)
            % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % reserveID;

    m_msgSocket->slotSendMsg(msg);
}


///////////////////////////////////////////////business///////////////////////////////////////////////////////
void HotelPlatformClient::connectSignalsSlotsForBusiness()
{
    ///////////////----------- m_hotelManage + m_houseManage ----------//////////////
    connect(m_msgSocket, SIGNAL(signalSetHotelManageList(bool,const QString&)),
            m_hotelManage, SLOT(slotSetHotelInfosList(bool,const QString&)));
    connect(m_msgSocket, SIGNAL(signalSetHotelManageImage(bool,const QString&,const QImage&)),
            m_hotelManage, SLOT(slotSetHotelInfosImage(bool,const QString&,const QImage&)));

    connect(m_hotelManage, SIGNAL(signalGainHotelDetails(const QString &)),
            this, SLOT(slotGainHotelDetails(const QString &)));
    connect(m_hotelManage, SIGNAL(signalDeleteHotelInfo(const QString &)),
            this, SLOT(slotDeleteHotelInfo(const QString &)));
    connect(m_hotelManage, SIGNAL(signalSubmitHotelInfo()),
            this, SLOT(slotSubmitHotelInfo()));
    connect(m_hotelManage, SIGNAL(signalGainHotelTypeInfo()),
            this, SLOT(slotGainHotelManageList()));
    connect(m_hotelManage, SIGNAL(signalGainHouseTypeInfo(const QString &,const QString &)),
            m_msgSocket, SLOT(slotGainHouseList(const QString &, const QString &)));
    connect(m_hotelManage, SIGNAL(signalDeleteHouseInfo(const QString &)),
            this, SLOT(slotDeleteHouseInfo(const QString &)));
    connect(m_hotelManage, SIGNAL(signalSubmitHouseInfo()),
            this, SLOT(slotSubmitHouseInfo()));

    connect(m_msgSocket,SIGNAL(signalHotelImageForBus()),          /// 酒店详情 设置图片
            m_hotelManage,SLOT(slotHotelImage()));
    connect(m_msgSocket,SIGNAL(signalSetHouseListForBus(bool,QString)),
            m_hotelManage,SLOT(slotSetHouseList(bool,QString)));
    connect(m_msgSocket,SIGNAL(signalHouseImageResultForBus(const QString&,const QImage&)),
            m_hotelManage,SLOT(slotSaveHouseImage(const QString&,const QImage&)));

    connect(m_msgSocket,SIGNAL(signalSubmitHouseResult(bool,const QString&)),
            m_hotelManage,SLOT(slotSubmitHouseResult(bool,const QString&)));
    connect(m_msgSocket,SIGNAL(signalDeleteHouseResult(bool,const QString&)),
            m_hotelManage,SLOT(slotDeleteHouseResult(bool,const QString&)));
    connect(m_msgSocket,SIGNAL(signalSubmitHotelResult(bool,const QString&)),
            m_hotelManage,SLOT(slotSubmitHotelResult(bool,const QString&)));
    connect(m_msgSocket,SIGNAL(signalDeleteHotelResult(bool,const QString&)),
            m_hotelManage,SLOT(slotDeleteHotelResult(bool,const QString&)));
    ///////////////----------- m_orderManage ----------//////////////
    connect(m_msgSocket,SIGNAL(signalUpdateOrderManageShow()),
            m_orderManage,SLOT(slotUpdateOrderManageShow()));
    connect(m_msgSocket,SIGNAL(signalModifyOrderStateResult(bool,const QString&)),
            m_orderManage,SLOT(slotModifyOrderStateResult(bool,const QString&)));
    connect(m_orderManage,SIGNAL(signalGainOrderManageList(const QString&)),
            this,SLOT(slotGainOrderManageList(const QString&)));
    connect(m_orderManage,SIGNAL(signalModifyOrderState(const QString&, const QString&)),
            this,SLOT(slotModifyOrderState(const QString&, const QString&)));
    ///////////////----------- m_commentManage ----------//////////////
    connect(m_msgSocket,SIGNAL(signalSetCommentListForBus(bool,const QString&)),
            m_commentManage,SLOT(slotSetCommentList(bool,const QString&)));
    connect(m_msgSocket,SIGNAL(signalSetCommentImageForBus(bool,const QString&,const QImage&)),
            m_commentManage,SLOT(slotSetCommentImage(bool,const QString&,const QImage&)));
    connect(m_commentManage,SIGNAL(signalSubmitBusComment(const QString &,const QString&)),
            this,SLOT(slotSubmitBusComment(const QString &,const QString&)));
    connect(m_msgSocket,SIGNAL(signalSubmitBusCommentResult(bool,const QString&)),
            m_commentManage,SLOT(slotSubmitBusCommentResult(bool,const QString&)));
    connect(m_commentManage,SIGNAL(signalRefreshComment(const QString &,const QString &)),
            this,SLOT(slotGainHotelCommentList(const QString &,const QString &)));

}
void HotelPlatformClient::gainHotelManageIdAndName()
{
    GlobalVars::g_hotelManageMap.clear();

    ///获取酒店管理的列表
    QString msg = QString(CMD_HotelManageIdAndName_V)
        % QString("#") % GlobalVars::g_localUser.getNumber();
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotGainHotelManageList()
{
    ///清空酒店管理的列表
    m_hotelManage->slotHotelManageListClean();
    GlobalVars::g_hotelManageList->clear();
    GlobalVars::g_hotelManageMap.clear();

    ///获取酒店管理的列表
    QString msg = QString(CMD_HotelManageList_Z)
        % QString("#") % GlobalVars::g_localUser.getNumber() % "|0";
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotDeleteHotelInfo(const QString &hotelID)
{
    QString msg = QString(CMD_DeleteHotel_Y)
        % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % hotelID ;
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotDeleteHouseInfo(const QString &houseID)
{
    QString msg = QString(CMD_DeleteHouse_y)
        % QString("#") % GlobalVars::g_localUser.getNumber()
             % "|" % houseID ;
    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::slotSubmitHotelInfo()
{
///user,id,name,location,star,type,city,phone,count,lowPrice,highPrice,openedTime,
///decoratedTime,description,cancel,introduce,Server,licenseImage,image
    QString msg = QString(CMD_SubmitHotel_W)
        % QString("#") % GlobalVars::g_localUser.getNumber()
             % "|" % GlobalVars::g_localHotel.getHotel()
            % "|" % GlobalVars::g_localHotel.getName()
            % "|" % GlobalVars::g_localHotel.getLocation()
            % "|" % GlobalVars::g_localHotel.getStar()
            % "|" % GlobalVars::g_localHotel.getType()
            % "|" % GlobalVars::g_localHotel.getCity()
            % "|" % GlobalVars::g_localHotel.getPhone()
            % "|" % QString::number(GlobalVars::g_localHotel.getTotalHouse())
            % "|" % QString::number(GlobalVars::g_localHotel.getLowPrice())
            % "|" % QString::number(GlobalVars::g_localHotel.getHighPrice())
            % "|" % GlobalVars::g_localHotel.getOpenedTime()
            % "|" % GlobalVars::g_localHotel.getDecoratedTime()
            % "|" % GlobalVars::g_localHotel.getDescription()
            % "|" % GlobalVars::g_localHotel.getCancellation()
            % "|" % GlobalVars::g_localHotel.getInstruction()
            % "|" % GlobalVars::g_localHotel.getServer();
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotSubmitHouseInfo()
{
    ///houseID, hotelID,houseType,price, count, area, capacity,bedType ,bathroom,
    /// window, net, breakfast, media,bathroomAcc
    qDebug() << "here";
    QString msg = QString(CMD_SubmitHouse_w)
        % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % GlobalVars::g_localHouse.getHouse()
            % "|" % GlobalVars::g_localHouse.getHotel()
            % "|" % GlobalVars::g_localHouse.getType()
            % "|" % QString::number(GlobalVars::g_localHouse.getPrice())
            % "|" % QString::number(GlobalVars::g_localHouse.getCount())
            % "|" % GlobalVars::g_localHouse.getArea()
            % "|" % QString::number(GlobalVars::g_localHouse.getCapacity())
            % "|" % GlobalVars::g_localHouse.getBedType()
            % "|" % GlobalVars::g_localHouse.getBathroom()
            % "|" % GlobalVars::g_localHouse.getNet()
            % "|" % GlobalVars::g_localHouse.getWindow()
            % "|" % GlobalVars::g_localHouse.getBreakfast()
            % "|" % GlobalVars::g_localHouse.getMedia()
            % "|" % GlobalVars::g_localHouse.getBathroomAcc();
    m_msgSocket->slotSendMsg(msg);
}

void HotelPlatformClient::slotGainOrderManageList(const QString &hotelID)
{
    GlobalVars::g_reserveInfoList->clear();

    ///获取酒店管理的列表
    QString msg = QString(CMD_OrderManageList_x)
        % QString("#") % GlobalVars::g_localUser.getNumber()
        % "|" % hotelID % "|0";
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotModifyOrderState(const QString &reserveID, const QString &state)
{
    ///获取酒店管理的列表
    QString msg = QString(CMD_ModifyOrderState_u)
        % QString("#") % GlobalVars::g_localUser.getNumber()
        % "|" % reserveID % "|" %  state;
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotSubmitBusComment(const QString &commentID,const QString &comment)
{
    ///houseID, hotelID,houseType,price, count, area, capacity,bedType ,bathroom,
    /// window, net, breakfast, media,bathroomAcc
    QString msg = QString(CMD_SubmitBusComment_r)
        % QString("#") % GlobalVars::g_localUser.getNumber()
            % "|" % commentID % "|" % comment;
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotGainHotelCommentList(const QString &index, const QString &commentID)
{
    GlobalVars::g_commentInfoList->clear();
    m_commentManage->slotCommentListClean();

    m_msgSocket->slotGainHotelCommentList(index, commentID);
}

///////////////////////////////////////////////worker///////////////////////////////////////////////////////
///////////////----------- m_orderManage ----------//////////////
void HotelPlatformClient::connectSignalsSlotsForWorker()
{
connect(m_msgSocket,SIGNAL(signalUpdateOrderShowForWorker()),
        m_orderCenter,SLOT(slotUpdateOrderShowForWorker()));
connect(m_orderCenter,SIGNAL(signalGainOrderAllList()),
        this,SLOT(slotGainOrderAllList()));
connect(m_msgSocket, SIGNAL(signalSetHotelCertList()),
        m_certCenter, SLOT(slotRefreshHotelCertList()));
connect(m_certCenter, SIGNAL(signalGainHotelDetails(const QString&)),
        this, SLOT(slotGainHotelDetails(const QString&)));
connect(m_msgSocket,SIGNAL(signalHotelImageForWorker()),          /// 酒店详情 设置图片
        m_certCenter,SLOT(slotHotelImage()));

connect(m_certCenter,SIGNAL(signalHotelPassCert(bool,const QString&)),
        this,SLOT(slotHotelPassCert(bool,const QString&)));
connect(m_msgSocket,SIGNAL(signalHotelCertResult(bool,const QString&)),
        m_certCenter,SLOT(slotHotelCertResult(bool,const QString&)));
connect(m_certCenter,SIGNAL(signalRefrushCertList(int)),
        this,SLOT(slotGainCertAllList(int)));

connect(m_msgSocket,SIGNAL(signalSetUserCertList(bool,const QString&)),
        m_certCenter,SLOT(slotUserCertList(bool,const QString&)));
connect(m_msgSocket,SIGNAL(signalUserCertResult(bool,const QString&)),
        m_certCenter,SLOT(slotUserCertResult(bool,const QString&)));
connect(m_certCenter,SIGNAL(signalPassCert(bool,const QString&)),
        this,SLOT(slotPassCertResult(bool,const QString&)));

connect(m_msgSocket,SIGNAL(signalSetUserCertImage(bool,const QString&,const QImage&)),
        m_certCenter,SLOT(slotSetUserCertImage(bool,const QString&,const QImage&)));

}
void HotelPlatformClient::slotGainOrderAllList()
{
    GlobalVars::g_reserveInfoList->clear();

    ///获取酒店管理的列表
    QString msg = QString(CMD_OrderManageList_x)
        % QString("#") % GlobalVars::g_localUser.getNumber() % "|0";
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotGainCertAllList(int index)
{
    qDebug() << "slotGainCertAllList(int index)" << index;
    QString msg;
    if (index == 0)         /// id
    {
        GlobalVars::g_userInfoList->clear();
        m_certCenter->cleanUserCertList();

        msg = QString(CMD_UserCert_O)
            % QString("#") % GlobalVars::g_localUser.getNumber() % "|0";
    }
    else                        /// hotel
    {
        GlobalVars::g_hotelManageList->clear();
        GlobalVars::g_hotelManageMap.clear();

        ///获取酒店管理的列表
        msg = QString(CMD_HotelManageList_Z)
            % QString("#") % GlobalVars::g_localUser.getNumber() % "|0";
    }
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotHotelPassCert(bool result,const QString& hotelID)
{
    QString msg;
    if (result)
    {
        msg = QString(CMD_HotelCertResult_K)
            % QString("#") % GlobalVars::g_localUser.getNumber()
                % "|" % hotelID % "|1";
    }
    else
    {
        msg = QString(CMD_HotelCertResult_K)
            % QString("#") % GlobalVars::g_localUser.getNumber()
                % "|" % hotelID % "|0";
    }
    m_msgSocket->slotSendMsg(msg);
}
void HotelPlatformClient::slotPassCertResult(bool result,const QString& userID)
{
    QString msg;
    if (result)
    {
        msg = QString(CMD_UserCertResult_J)
            % QString("#") % GlobalVars::g_localUser.getNumber()
                % "|" % userID % "|1";
    }
    else
    {
        msg = QString(CMD_UserCertResult_J)
            % QString("#") % GlobalVars::g_localUser.getNumber()
                % "|" % userID % "|0";
    }
    m_msgSocket->slotSendMsg(msg);
}



